package sandbox;

import java.util.HashSet;
import java.util.Set;

public final class WorkerSet {
	private static volatile Set<Worker> workers = null;

	public static void add(Worker[] workers) {
		if (workers == null)
			return;
		if (WorkerSet.workers == null) {
			synchronized (WorkerSet.class) {
				if (WorkerSet.workers == null)
					WorkerSet.workers = new HashSet<Worker>();
			}
		}

		for (Worker worker : workers)
			WorkerSet.workers.add(worker);
	}

	public static Set<Worker> get() throws Exception {
		if (WorkerSet.workers == null)
			throw new Exception("WorkerSet.workers == null");
		return WorkerSet.workers;
	}

	class Worker extends Base {
	}
}